package sdau.hjk.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import sdau.hjk.entity.Major;

import java.util.List;

/**
 *@version 1.0
 *@author: huangjiakai
 *@create:2021−04-22 15:29
 *@className:sdau.hjk.dao.IMajorDao
 *@description: TODO
 */
@Repository
public interface IMajorDao {
    //查询所有专业班级
    @Select("select * from class order by major")
    public List<Major> findAll();
    //查询专业
    @Select("select distinct major from class")
    public List<Major> findMajor();
    //查询班级
    @Select("select distinct grade from class order by grade")
    public List<Major> findGrade();
    //保存专业班级
    @Insert("insert into class(major,grade) values(#{major},#{grade})")
    public void saveMajor(Major major);
    //删除专业班级
    @Delete("delete from class where major = #{major} and grade = #{grade}")
    public void deleteMajor(Major major);
    
}
